
package com.apes.fn.crm.ReturnVisit.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.party.model.AccessProvider;
import com.apes.scm.masterdata.product.model.ServeType;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 售后回访条件
 *
 * @author bbyford
 * @create 2020-2-5
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicUpdate
@DynamicInsert
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = VisitCondition.CONST_TABLE_NAME)
public class VisitCondition extends Model {
    public static final String CONST_TABLE_NAME = "fn_visit_condition";

    @Id
    @Comment("编码")
    @Column(name = "id", nullable = false, length = 32)
    @ApesGenerator(code = "fn_visit_condition", name = "售后回访条件")
    private String id;

    @Comment("接入商")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "access_provider_id", referencedColumnName = "id")
    private AccessProvider accessProvider;

    @Comment("服务类型")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "serve_type_id", referencedColumnName = "id", nullable = false)
    private ServeType serveType;

    @Column(name = "total", nullable = false, columnDefinition = ApesConst.FIELD_16_4_0)
    @Comment("最小销售金额")
    private double total = 0;

}


